import java.io.*;
public class Main {

	public static void main(String[] args) {
		try{
			if(args.length<2){
				printErr();
				System.exit(0);
			}
			
			if(args[0].equals("1")){
				args[0]=args[1];
				if(args.length>2){
					args[1]=args[2];
				}
				if(args.length>3){
					args[2]=args[3];
				}
				if(args.length>4){
					args[3]=args[4];
				}
				AnalyzeAllFind.main(args);
				AnalyzeDir2Mr.main(args);
				AnalyzeFiles4.main(args);
				
			}else if(args[0].equals("2")){
				args[0]=args[1];
				if(args.length>2){
					args[1]=args[2];
				}
				if(args.length>3){
					args[2]=args[3];
				}
				if(args.length>4){
					args[3]=args[4];
				}
				if(args.length>5){
					args[4]=args[5];
				}
				if(args.length>6){
					AnalyzeWithExistDir1.generateScriptFlag=true;
				}
				System.out.println("step 1");
				AnalyzeWithExistDir1.main(args);
			}else{
				printErr();

			}
			
		}catch(Throwable e){
			e.printStackTrace();
		}

	}
	
	
	static void printErr(){
		System.out.println("usage: DupFileFind <1|2> <File/Dir Name>  (ignore-dir-name-flag) (append-flag)");
		System.out.println("eg: DupFileFind 1 __home__UserDir  t f");
		System.out.println("eg: DupFileFind 2 /home/UserDir2  t f");
		System.out.println("Note: <1/2> for One Way or Two Way Comparison");
		System.out.println("Note: file name with \"__\" as path seperator if offline detection using \"ls -laR\" output.\n\t Eg: go to /home/abc/xyz  and do 'ls -laR > __home__abc__xyz' and give this file as input to this program");
		System.out.println("Note: ignore-dir-name-flag is by default true(same dir contents but different names)");
		System.out.println("Note: append-flag if multiple file systems have to be compared as one unit.");
		System.out.println("each run output is backed up in tmp<timestamp directory>");
		System.out.println("two way comparison output goes to 'second' directory");
		
	}

}
